import 'package:flutter/material.dart';
import 'package:qqmusic/page/detail_page/reject.dart';

class home extends StatefulWidget {
  home({Key key}) : super(key: key);

  @override
  State<home> createState() => _homeState();
}

class _homeState extends State<home>
    with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
  List<Widget> tabs = [
    Text('推荐'),
    Text('音乐馆'),
    Text('电台'),
    Text('欧美'),
    Text('Kpop'),
    Text('data')
  ];
  TabController controller;
  @override
  void initState() {
    super.initState();
    controller =
        TabController(length: tabs.length, vsync: this, initialIndex: 0);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 15),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SafeArea(
            child: Container(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                      width: MediaQuery.of(context).size.width - 60,
                      child: Theme(
                        data: ThemeData(
                            splashColor: Colors.transparent,
                            highlightColor: Colors.transparent),
                        child: TabBar(
                          isScrollable: true,
                          tabs: tabs,
                          controller: controller,
                          labelColor: Color(0xff242525),
                          labelStyle: TextStyle(
                              fontSize: 18, fontWeight: FontWeight.w700),
                          unselectedLabelColor: Color(0xff252827),
                          indicatorSize: TabBarIndicatorSize.label,
                          unselectedLabelStyle: TextStyle(fontSize: 17),
                          indicatorColor: Color(0xff3be68e),
                          indicatorWeight: 5,
                        ),
                      )),
                  Icon(Icons.more_horiz)
                ],
              ),
            ),
          ),
          Expanded(
              child: TabBarView(
            children: [
              reject(),
              Text('data'),
              Text('data'),
              Text('data'),
              Text('data'),
              Text('data')
            ],
            controller: controller,
          ))
        ],
      ),
    );
  }

  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;
}
